package com.ruoyi.handing.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.handing.domain.AlgsStaffReview;
import com.ruoyi.handing.service.IAlgsStaffReviewService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 审核员工Controller
 * 
 * @author ruoyi
 * @date 2023-03-24
 */
@RestController
@RequestMapping("/staffReview")
public class AlgsStaffReviewController extends BaseController
{
    @Autowired
    private IAlgsStaffReviewService algsStaffReviewService;

    /**
     * 查询审核员工列表
     */
    @RequiresPermissions("staffReview:staffReview:list")
    @GetMapping("/list")
    public TableDataInfo list(AlgsStaffReview algsStaffReview)
    {
        startPage();
        List<AlgsStaffReview> list = algsStaffReviewService.selectAlgsStaffReviewList(algsStaffReview);
        return getDataTable(list);
    }

    /**
     * 导出审核员工列表
     */
    @RequiresPermissions("staffReview:staffReview:export")
    @Log(title = "审核员工", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AlgsStaffReview algsStaffReview)
    {
        List<AlgsStaffReview> list = algsStaffReviewService.selectAlgsStaffReviewList(algsStaffReview);
        ExcelUtil<AlgsStaffReview> util = new ExcelUtil<AlgsStaffReview>(AlgsStaffReview.class);
        util.exportExcel(response, list, "审核员工数据");
    }

    /**
     * 获取审核员工详细信息
     */
    @RequiresPermissions("staffReview:staffReview:query")
    @GetMapping(value = "/{staffReviewId}")
    public AjaxResult getInfo(@PathVariable("staffReviewId") Long staffReviewId)
    {
        return success(algsStaffReviewService.selectAlgsStaffReviewByStaffReviewId(staffReviewId));
    }

    /**
     * 新增审核员工
     */
    @RequiresPermissions("staffReview:staffReview:add")
    @Log(title = "审核员工", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AlgsStaffReview algsStaffReview)
    {
        return toAjax(algsStaffReviewService.insertAlgsStaffReview(algsStaffReview));
    }

    /**
     * 修改审核员工
     */
    @RequiresPermissions("staffReview:staffReview:edit")
    @Log(title = "审核员工", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AlgsStaffReview algsStaffReview)
    {
        return toAjax(algsStaffReviewService.updateAlgsStaffReview(algsStaffReview));
    }

    /**
     * 删除审核员工
     */
    @RequiresPermissions("staffReview:staffReview:remove")
    @Log(title = "审核员工", businessType = BusinessType.DELETE)
	@DeleteMapping("/{staffReviewIds}")
    public AjaxResult remove(@PathVariable Long[] staffReviewIds)
    {
        return toAjax(algsStaffReviewService.deleteAlgsStaffReviewByStaffReviewIds(staffReviewIds));
    }
}
